package com.hatch.ui
{
	import com.hatch.ui.Component;
	
	import flash.events.MouseEvent;
	
	/**
  	* This is a generic base class for buttons.  
  	* Extend this when building interactive user interface elements.
  	* 
  	* <p>
  	* 
  	* Extends base class com.hatch.ui.Component 
	* 
  	* Standard button listeners and methods included
	*
  	* </p>
	*
  	*/

	public class Button extends Component
	{
		public function Button()
		{
			super();
		}

		override protected function init():void
		{
			initButton();
			super.init();
		}
		
		protected function initButton():void
		{
       		this.buttonMode 	= true;
			this.useHandCursor 	= true;
        	this.mouseChildren 	= false;
        	
        	this.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);        	
        	this.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
        	this.addEventListener(MouseEvent.CLICK, onClick);
        }

		
		//--------------------------------------
		//  Private / Protected Methods
		//--------------------------------------
        
		protected function onMouseOver( event:MouseEvent=null):void
        {
        	if(!this.enabled) return;
        }
        
        protected function onMouseOut( event:MouseEvent=null):void
        {      
        	if(!this.enabled) return;    
        }
        
        protected function onClick( event:MouseEvent = null):void
        {
        	if(!this.enabled) return;
        }
        
        //--------------------------------------
		//  Getters / Setters
		//--------------------------------------
        
        override public function set enabled(value:Boolean):void
        {
        	useHandCursor = value;
			mouseEnabled = value;
			super.enabled = value;	
        }
	}
}